package com.atguigu.schedule.pojo;

import java.io.Serializable;
import java.util.Objects;

/**
 * 1. 实体类的类名和表格名称应该对应（驼峰式+见名知意）
 * 2. 实体类属性名和表格的列名要对应
 * 3. 每个属性必须私有
 * 4. 每个属性必须有getter setter
 * 5. 一定有无参构造器（Tomcat建议显式地写出来）
 * 6. 应该实现序列化接口（缓存 分布式项目数据传递，可能会将对象序列化）
 * 7. 应该重写类的hashCode和equals方法
 * 8. toString是否重写 都可以
 *
 * 使用lombok帮助我们生成getter setter 全参构造 无参构造 equals hashCode 使用步骤
 *      1. 检查是否安装lombok插件
 *      2. 检查是否勾选enable annotation processing
 *      3. 导入lombok依赖
 *      4. 实体类上添加注解
 *
 * @author yuezi2048
 * @version 1.0
 */
public class SysUser implements Serializable {
    private Integer uid;
    private String username;
    private String userPwd;

    public SysUser() {
    }

    public SysUser(Integer uid, String username, String userPwd) {
        this.uid = uid;
        this.username = username;
        this.userPwd = userPwd;
    }

    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getUserPwd() {
        return userPwd;
    }

    public void setUserPwd(String userPwd) {
        this.userPwd = userPwd;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SysUser sysUser = (SysUser) o;
        return Objects.equals(uid, sysUser.uid) && Objects.equals(username, sysUser.username) && Objects.equals(userPwd, sysUser.userPwd);
    }

    @Override
    public int hashCode() {
        return Objects.hash(uid, username, userPwd);
    }

    @Override
    public String toString() {
        return "SysUser{" +
                "uid=" + uid +
                ", username='" + username + '\'' +
                ", userPwd='" + userPwd + '\'' +
                '}';
    }
}
